package Collection.list;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Listdemo1 {
    @Test
    public void method1(){
        List<String> list1=new ArrayList<>();
        list1.add("hello");
        list1.add("java");
        System.out.println(list1);
        for(String temp:list1){
            System.out.println(temp);
        }
        Iterator<String> iterator = list1.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        for (int i=0;i<list1.size();i++){

            System.out.println(list1.get(i));
        }
    }

}
